package com.google.code.qsecurity.server.util;

import java.util.Random;

import com.google.code.qsecurity.shared.QSettings;

public class RequestCodeGenerator {
	
	private static final Random generator = new Random();
	
	private static final String CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

	public static String generate()
	{
	    char[] code = new char[QSettings.VERIFICATION_CODE_LENGTH];
	    for (int i = 0; i < QSettings.VERIFICATION_CODE_LENGTH; i++)
	    {
	        code[i] = CHARS.charAt(generator.nextInt(CHARS.length()));
	    }
	    return new String(code);
	}
	
}
